C
C==================================================================
C
C   int1_8    Programe for integration of real*8 function.
C   int1_4    Programe for integration of real*4 function.
C   int2_8    Programe for integration of two real*8 functions.
C   int2_4    Programe for integration of two real*4 functions. 
C   int3_8    Programe for integration of three real*8 functions.
C   int3_4    Programe for integration of three real*4 functions.
C
C      call int1_8 (f1, nf1, nl1, res, weight, nr)
C      call int1_4 (f1, nf1, nl1, res, weight, nr)
C      dimension f1(nl1), weight(nr)
C
C      call int2_8 (f1, nf1, nl1, f2, nf2, nl2, res, weight, nr)
C      call int2_4 (f1, nf1, nl1, f2, nf2, nl2, res, weight, nr)
C      dimension f1(nl1), f2(nl2), weight(nr)
C
C      call int3_8 (f1, nf1, nl1, f2, nf2, nl2, f3, nf3, nl3,
C     >   res, weight, nr)
C      call int3_4 (f1, nf1, nl1, f2, nf2, nl2, f3, nf3, nl3,
C     >   res, weight, nr)
C      dimension f1(nl1), f2(nl3), f2(nl3), weight(nr)
C
C==================================================================
C   Real*8  Programe for integration of three functions
C==================================================================
      subroutine int3_8 (f1, nf1, nl1, f2, nf2, nl2, f3, nf3, nl3,
     >   res, weight, nr)
      implicit real*8 (a-h, o-z)
      dimension f1(nl1), f2(nl2), f3(nl3), weight(nr)
      if ((nl1 .gt. nr)  .or.  (nl2 .gt. nr) .or.  (nl3 .gt. nr)) then
         print*, 'Number of points are not enough in r-mesh'
         print*, 'the last point of "F1"=', nl1
         print*, 'the last point of "F2"=', nl2
         print*, 'the last point of "F3"=', nl3
         print*, 'the last point of "WEIGHT"=', nr
         stop 'stop  in  "INT3_8"'
      end if 
      res = 0.0d0
      do i = max(nf1, nf2, nf3), min(nl1, nl2, nl3)
         res = res + f1(i) * f2(i) * f3(i) * weight(i)
      end do 
      return
      end
C==================================================================
C   Real*4  Programe for integration of three functions
C==================================================================
      subroutine int3_4 (f1, nf1, nl1, f2, nf2, nl2, f3, nf3, nl3,
     >   res, weight, nr)
      dimension f1(nl1), f2(nl2), f3(nl3), weight(nr)
      if ((nl1 .gt. nr)  .or.  (nl2 .gt. nr) .or.  (nl3 .gt. nr)) then
         print*, 'Number of points are not enough in r-mesh'
         print*, 'the last point of "F1"=', nl1
         print*, 'the last point of "F2"=', nl2
         print*, 'the last point of "F3"=', nl3
         print*, 'the last point of "WEIGHT"=', nr
         stop 'stop  in  "INT3_4"'
      end if 
      res = 0.0
      do i = max(nf1, nf2, nf3), min(nl1, nl2, nl3)
         res = res + f1(i) * f2(i) * f3(i) * weight(i)
      end do 
      return
      end
C==================================================================
C     Programe for integration of two functions in double prec.
C==================================================================
      subroutine int2_8 (f1, nf1, nl1, f2, nf2, nl2, res, weight, nr)
      implicit real*8 (a-h, o-z)
      dimension f1(nl1), f2(nl2), weight(nr)
      if ((nl1 .gt. nr)  .or.  (nl2 .gt. nr)) then
         print*, 'Number of points are not enough in r-mesh'
         print*, 'the last point of "F1"=', nl1
         print*, 'the last point of "F2"=', nl2
         print*, 'the last point of "WEIGHT"=', nr
         stop 'stop  in  "INT2_8"'
      end if 
      res = 0.0d0
      do i = max(nf1, nf2), min(nl1, nl2)
         res = res + f1(i) * f2(i) * weight(i)
      end do 
      return
      end
C==================================================================
C     Programe for integration of two functions
C==================================================================
      subroutine int2_4 (f1, nf1, nl1, f2, nf2, nl2, res, weight, nr)
      dimension f1(nl1), f2(nl2), weight(nr)
      if ((nl1 .gt. nr)  .or.  (nl2 .gt. nr)) then
         print*, 'Number of points are not enough in r-mesh'
         print*, 'the last point of "F1"=', nl1
         print*, 'the last point of "F2"=', nl2
         print*, 'the last point of "WEIGHT"=', nr
         stop 'stop  in  "INT2_4"'
      end if 
      res = 0.0
      do i = max(nf1, nf2), min(nl1, nl2)
         res = res + f1(i) * f2(i) * weight(i)
      end do 
      return
      end
C==================================================================
C     Programe for integration of one function
C==================================================================
      subroutine int1_4 (f1, nf1, nl1, res, weight, nr)
      dimension f1(nl1), weight(nr)
      if (nl1 .gt. nr) then
         print*, 'Number of points are not enough in r-mesh'
         print*, 'the last point of "F1"=', nl1
         print*, 'the last point of "WEIGHT"=', nr
         stop 'stop  in  "INT1_4"'
      end if 
      res = 0.0
      do i = nf1, nl1 
         res = res + f1(i) * weight(i)
      end do 
      return
      end
C==================================================================
C     Programe for integration of one function in double prec.
C==================================================================
      subroutine int1_8 (f1, nf1, nl1, res, weight, nr)
      implicit real*8 (a-h, o-z)
      dimension f1(nl1), weight(nr)
      if (nl1 .gt. nr) then
         print*, 'Number of points are not enough in r-mesh'
         print*, 'the last point of "F1"=', nl1
         print*, 'the last point of "WEIGHT"=', nr
         stop 'stop  in  "INT1_8"'
      end if 
      res = 0.0d0
      do i = nf1, nl1 
         res = res + f1(i) * weight(i)
      end do 
      return
      end
         
